import {
  $ActionButton,
  $ActionButtons,
  $Area,
  $SuperTable,
  $TableFilter,
  $TableTools,
  $dialogInstance,
  // --------------
  $modules,
  $tanInstance,
} from '@/.jiess';
import '@/.jiess/react168antd/css/base.css';
import JiessMidder from '@jiess/utils/midder';
import { message } from 'antd';
import React from 'react';
// ===============================================================
export const tools = $modules;
const { JiessEnv, $entry, $component } = $modules;

const jiess = $entry(
  JiessEnv,
  // 静态注入到jiess实例中
  {
    useRef: React.useRef,
    useEffect: React.useEffect,
    useState: React.useState,
    useReducer: React.useReducer,
    createElement: React.createElement,
    // $render(...args) {
    // 	console.log(args)
    // 	return React.createElement(...args)
    // }
  },
  // 动态注入到组件上下文中
  {
    area: $Area,
    $tan: $tanInstance,
    dialog: $dialogInstance,
    // 定义项目共享中介者
    $midder: new JiessMidder('GlobalMidder', 'no-store'),
    // 注入全局的消息提示
    $msg: (msg, type = 'success') => message[type](msg),
  },
);
$component('jiess', jiess.JiessComponent);
$component($SuperTable.name, $SuperTable);
$component($ActionButton.name, $ActionButton);
$component($ActionButtons.name, $ActionButtons);
$component($TableTools.name, $TableTools);
$component($TableFilter.name, $TableFilter);
export const JiessComponent = jiess.JiessComponent;
